package com.prs.crm.domain.store;
/**
 * @author 兰小刚
 * @version 
 * 类说明
 */
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.FlowCodeEntity;

/**
 * 库房调拨
 * @author LXG
 *
 */

@Entity
@Table(name="stock_storeflit")
public class StoreFlit extends FlowCodeEntity {
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	
	/**
	 * 调拨主题
	 */
	private String flitName;
	/**
	 * 调拨日期
	 */
	private Date flitDate;
	/**
	 * 调出仓库
	 */
	@ManyToOne
	private StoreRoom flitOutRoom;
	/**
	 * 调入仓库
	 */
	@ManyToOne
	private StoreRoom flitInRoom;
	/**
	 * 调拨明细
	 */
	@OneToMany(mappedBy = "storeflit")
	@Cascade( { org.hibernate.annotations.CascadeType.ALL,
			org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
	private Set<StoreFlitDetail> details;
	/**
	 * 调拨概要
	 */
	@Lob
	private String flitRemark;
	
	/**
	 * 批号
	 * @return
	 */
	
	private String  batchNum;
	/**
	 * 编码
	 */
	private String  storeFlitCode;
	
//	@OneToOne(fetch=FetchType.LAZY,mappedBy="storeflit")
//	private Code code;
//	
//	
	/**
	 * 
	 */
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getFlitName() {
		return flitName;
	}
	public void setFlitName(String flitName) {
		this.flitName = flitName;
	}
	public Date getFlitDate() {
		return flitDate;
	}
	public void setFlitDate(Date flitDate) {
		this.flitDate = flitDate;
	}
	public StoreRoom getFlitOutRoom() {
		return flitOutRoom;
	}
	public void setFlitOutRoom(StoreRoom flitOutRoom) {
		this.flitOutRoom = flitOutRoom;
	}
	public StoreRoom getFlitInRoom() {
		return flitInRoom;
	}
	public void setFlitInRoom(StoreRoom flitInRoom) {
		this.flitInRoom = flitInRoom;
	}
	public Set<StoreFlitDetail> getDetails() {
		return details;
	}
	public void setDetails(Set<StoreFlitDetail> details) {
		this.details = details;
	}
	public String getFlitRemark() {
		return flitRemark;
	}
	public void setFlitRemark(String flitRemark) {
		this.flitRemark = flitRemark;
	}

	public void addDetail(StoreFlitDetail detail) {
		if (details == null)
			details = new HashSet<StoreFlitDetail>();
		detail.setStoreflit(this);
		details.add(detail);
	}
	public String getBatchNum() {
		return batchNum;
	}
	public void setBatchNum(String batchNum) {
		this.batchNum = batchNum;
	}
	public String getStoreFlitCode() {
		return storeFlitCode;
	}
	public void setStoreFlitCode(String storeFlitCode) {
		this.storeFlitCode = storeFlitCode;
	}
//	public Code getCode() {
//		return code;
//	}
//	public void setCode(Code code) {
//		this.code = code;
//	}
	
}
